package sh.wnxy.wn38.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import sh.wnxy.wn38.entity.Cart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import sh.wnxy.wn38.entity.Ticket;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wn38
 * @since 2021-07-13
 */
public interface CartMapper extends BaseMapper<Cart> {

    @Select("select * from cart where cart_userid=#{id}")
    List<Cart> selectall(String id);

    @Select("select * from ticket where ticket_id=#{id}")
    Ticket selectTicket(Integer id);
    @Select("Select spot_name from spot where spot_id=#{ticketSpotId}")
    String getSpotName(Integer ticketSpotId);
    @Select("Select spot_img from img where img_id=(select spot_imgid  from spot where spot_id=#{id});")
    String selectPath(Integer id);

    @Update("update cart set cart_num=#{number} where cart_id=#{index}")
    boolean updateNumber(@Param("index") Integer index, @Param("number") Integer number);




}
